<?php
// @formatter:off
/**
 * @file config.php
 * @author Alejandro Dario Simi
 * @date $Date: 2013-07-05 14:30:06 +0000 (Fri, 05 Jul 2013) $
 *
 * $Id: config.php 89 2013-07-05 14:30:06Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0.0.1/config/config.php $
 */
// @formatter:on

$wcROOTDIR = dirname(dirname(__FILE__));
$wcROOTURI = substr(dirname($_SERVER["SCRIPT_FILENAME"]), strlen($_SERVER["DOCUMENT_ROOT"]));
//
// Detecting command line access.
if(php_sapi_name() == "cli") {
	define("__SHELL__", php_sapi_name());
}
//
// Detected mobile access.
if(!defined("__SHELL__") && preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|sagem|sharp|sie-|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER["HTTP_USER_AGENT"])) {
	define("__IS_MOBILE__", true);
}

require_once "{$wcROOTDIR}/config/defines.php";

// @formatter:off
/**
* @todo documentar
* @var int
*/
$wcErrno		= 0;
/**
* @todo documentar
* @var string
*/
$wcError		= "";
/**
* List of componet versions.
* @var array
*/
$wcVersions		= array();
/**
* List of default parameters.
* @var array
*/
$wcDefaults		= array();
/**
* Site specific configurations.
* @var array
*/
$wcSite			= array();
/**
* List of handlers for service.php.
* @var array
*/
$wcServicesHandlers	= array();
/**
* List of handlers for rss.php.
* @var array
*/
$wcRSSHandlers		= array();
/**
* List of useful locations.
* @var array
*/
$wcPaths		= array();
/**
* Permissions assignments
* @todo explicar.
* @var array
*/
$wcPermissions		= array(
	"_names"	=> array(
		"profiles"	=> array("*", "ROOT", "ADMIN", "ORGANIZER", "COLLECTOR", "TAGGER", "USER", "ANON"),
		"methods"	=> array("*", "POST", "GET"),
		"pages"		=> array("*", "index", "mobile", "simple", "service", "rss")
	),
	"default"	=> "ANON",
	"pyramid"	=> array(),
	"rights"	=> array(),
	// Each permission assigned through pyramid-perms will also be assigned to
	// higher ranking users.
	"pyramid-perms"	=> array(),
	// Each permission assigned through direct-perms will only be assigned to
	// the specified user rank.
	"direct-perms"	=> array()
);
/**
* @TODO documentar
* @var array
*/
$wcSpecialTags		= array();
/**
* @var array
* @code
*	$wcExtensionInfo[] = array(
*		'name'		=> "NAME",
*		'description'	=> "DESCRIPTION",
*		'version'	=> "VERSION_STRING",
*		'url'		=> "HOMEPAGE_LINK",
*		'author'	=> "AUTHOR"
*	);
* @endcode
*
* Also:
* @code
*	$wcExtensionInfo[] = array(
*		'name'		=> "NAME",
*		'description'	=> "DESCRIPTION",
*		'version'	=> "VERSION_STRING",
*		'url'		=> array(
* 					"title"	=> "LINK_TITLE",
* 					"href"	=> "HOMEPAGE_LINK"
* 				   ),
*		'author'	=> "AUTHOR"
*	);
* @endcode
*/
$wcExtensionInfo	= array();
/**
* @var array
* List of hooks for rules actions manager.
* Every item must be added in this way:
* @code
*	$wcRuleHooks[ALFANUMERIC_CODE_TO_IDENTIFY_ITS_TYPE] = array(
*		'name'		=> "ACTION_TYPE_NAME",
*		'description'	=> "ACTION_TYPE_DESCRIPTION",
*		'class'		=> "ACTION_TYPE_MAIN_CLASS_NAME",
*		'page'		=> "FULL_PATH_TO_EDITION_PAGE.php",
*		'conficts'	=> "FUNCTION_NAME",			[OPTIONAL]
*		'version'	=> "EXTENSION_VERSION_STRING",
*		'url'		=> "EXTENSION_HOMEPAGE_LINK",
*		'database'	=> "DATABASE_CHECK_FUNCTION"		[OPTIONAL]
*	);
* @endcode
*/
$wcRuleHooks		= array();
/**
* @var string[string][]
* Each element must be added like this:
* @code
*	$wcCanvasActions["subaction-name"] = array(
*		"manager"	=> "php-manager-path",
*		"template"	=> "template-full-path"
*	);
* @endcode
*/
$wcCanvasActions	= array();
/**
* @var string[string][]
* Each element must be added like this:
* @code
*	$wcRightTools[] = array(
*		"title"		=> "Section Title",
*		"manager"	=> "php-manager-path",
*		"template"	=> "template-full-path",
*		"checker"	=> "optional-functioname",
*		"times"		=> "repeat"
*	);
* @endcode
*/
$wcRightTools		= array();
/**
* @var string[string][]
* Each element must be added like this:
* @code
*	$wcRightAdds[] = array(
*		"manager"	=> "php-manager-path",
*		"template"	=> "template-full-path",
*		"checker"	=> "optional-functioname",
*		"times"		=> "repeat"
*	);
* @endcode
*/
$wcRightAdds		= array();
/**
* Database access information. It must contain these associative elements:
*	- server	Server where the database is hosted.
*	- username	Username with permission to use the database.
*	- password	Password for the given username.
*	- database	Database name.
*
* It may also contain:
*	- prefix	Prefix for every table. By default it is "wc_".
* @var array
*/
$wcDatabaseAccess	= array(
	"server"	=> false,
	"username"	=> false,
	"password"	=> false,
	"database"	=> false,
	"prefix"	=> "wc_"
);
$wcDatabase		= array(
	"aggressive"	=> false,
	"indexes"	=> array(),
	"tables"	=> array()
);

/**
* Configuration for cron.php.
* Every item must be added in this way:
*	$wcCronScripts[NUMERIC_ID] = array(
*		"name"		=> "TITLE",
*		"path"		=> "FULL_PATH.php",
*		"params"	=> array(
*			"PARAM1",
*			"PARAM2"
*		),
*		"url"		=> "EXTENSION_HOMEPAGE_LINK"
* @todo UPDATE
*	);
*
* @var array
*/
$wcCronScripts		= array();
/**
* @todo doc
* @var string
*/
$wcCronProfile		= "default";
/**
* @todo doc
* @var array
*/
$wcCronProfiles		= array();
/**
* Configuration for tool.php.
* Every item must be added in this way:
*	$wcToolScripts[ALFANUMERIC_ID] = array(
*		"name"		=> "TITLE",
*		"path"		=> "FULL_PATH.php", [OPTIONA]
*		"url"		=> "EXTENSION_HOMEPAGE_LINK"
*	);
*
* @var array
*/
$wcToolScripts		= array();
/**
* @TODO documentar
* @var WCTheme
*/
$wcTheme		= false;
/**
* @TODO documentar
* @var array()
*/
$wcThemeClasses		= array();
/**
* @TODO documentar
* @var array()
*/
$wcThemeDefaults	= array();
/**
* @TODO documentar
* @var array()
*/
$wctDefaults		= array();
/**
* @var multitype
*/
$wcUserXData		= array(
	"_types" => array(
		"date", "string", "text", "number", "list"
	),
	"_fields" => array(
		"name", "title", "type", "values", "default"
	),
	"_names" => array(),

	array(
		"name"		=> "BIRTHDAY",
		"title"		=> "Birth Day",
		"type"		=> "date",
		"values"	=> false,
		"default"	=> ""
	),
	array(
		"name"		=> "GENDER",
		"title"		=> "Gender",
		"type"		=> "list",
		"values"	=> array("male","female","untold"),
		"default"	=> "untold"
	)
);

define("WC_USER_ROOT_ID",	"1");
define("WC_USER_CRON_ID",	"2");
define("WC_USER_ROOT_NAME",	"root");
define("WC_USER_CRON_NAME",	"cron");

$wcPatterns			= array();
$wcPatterns["comic-patterns"]	= array('/\.cbz$/', '/\.cbr$/', '/\.cbt$/', '/\.zip$/', '/\.rar$/', '/\.tar$/');
$wcPatterns["image-paths"]	= array('/\.jpg$/', '/\.png$/', '/\.jpeg$/', '/\.JPG$/', '/\.PNG$/', '/\.JPEG$/');
$wcPatterns["info-paths"]	= array('/gallery\.xml$/', '/url\.xml$/');
$wcReplaceURL	= array(
	'in'  => array('%',   '+',   '#',   'ñ',   'Ñ',   ' ',   '&'),
	'out' => array('%25', '%2B', '%23', '%A4', '%A5', '%20', '%26')
);
$wcReplacePath	= array(
	'in'  => array('.',   '[',   ']',   '(',   ')',   '%',   '^',     '+'),
	'out' => array('\\.', '\\[', '\\]', '\\(', '\\)', '\\%', '\\^', '\\+')
);

/**
* Global Preconfiguration
* @{
*/
$wcDatabaseAccess["server"]	= false;
$wcDatabaseAccess["username"]	= false;
$wcDatabaseAccess["password"]	= false;
$wcDatabaseAccess["database"]	= false;

$wcVersions["name"]	= "wcomix";
$wcVersions["version"]	= "1.0";
$wcVersions["jquery"]	= "1.8.0";
$wcVersions["jqueryui"]	= "1.8.22";

$wcPaths["config-local"]		= "{$wcROOTDIR}/local.conf.php";
$wcPaths["cache-directory"]		= "{$wcROOTDIR}/cache";
$wcPaths["config-directory"]		= "{$wcROOTDIR}/config";
$wcPaths["includes-directory"]		= "{$wcROOTDIR}/includes";
$wcPaths["includes-directory-uri"]	= "includes";
$wcPaths["services-directory"]		= "{$wcROOTDIR}/services";
$wcPaths["rss-directory"]		= "{$wcROOTDIR}/rss";
$wcPaths["tools-directory"]		= "{$wcROOTDIR}/tools";
$wcPaths["cron-directory"]		= "{$wcROOTDIR}/cron";
$wcPaths["cache-directory-uri"]		= 'cache';
$wcPaths["cache-thumbs-dirname"]	= 'thumbs';
$wcPaths["cache-expand-dirname"]	= 'expanded';
$wcPaths["install-directory"]		= "{$wcROOTDIR}/install";
$wcPaths["extensions-directory"]	= "{$wcROOTDIR}/extensions";
$wcPaths["extensions-directory-uri"]	= "extensions";
$wcPaths["logs-directory"]		= "{$wcPaths["cache-directory"]}/logs";
$wcPaths["themes-directory"]		= "{$wcROOTDIR}/themes";
$wcPaths["captcha-directory"]		= "{$wcPaths["includes-directory"]}/securimage";
$wcPaths["captcha-directory-uri"]	= "{$wcPaths["includes-directory-uri"]}/securimage";
/*
* Installation temporary paths.
* @{
*/
$wcPaths["install-tmps"]		= array();
$wcPaths["install-tmps"]["defaults"]	= "{$wcPaths["cache-directory"]}/install.defaults.php";
$wcPaths["install-tmps"]["step"]	= "{$wcPaths["cache-directory"]}/install.step.php";
$wcPaths["install-tmps"]["db"]		= "{$wcPaths["cache-directory"]}/install.db.php";
$wcPaths["install-tmps"]["group"]	= "{$wcPaths["cache-directory"]}/install.group.php";
$wcPaths["install-tmps"]["cron"]	= "{$wcPaths["cache-directory"]}/install.cron.php";
$wcPaths["install-tmps"]["cron-check"]	= "{$wcPaths["cache-directory"]}/install.cron-check.php";
/* @} */

$wcSite["name"]		= "My Comics Site";
$wcSite["email"]	= "noreplay@localhost";
$wcSite["wiki"]		= false;

/*
* @{
*/
$wcCompressors		= array();
$wcCompressors["RAR"]	= array(
	"extensions"	=> array("cbr", "rar"),
	"binary"	=> "rar",
	"cmd-skeleton"	=> "{COMMAND} 'x' \"{COMIC}\" '-w' \"{DIRECTORY}\""
);
$wcCompressors["ZIP"]	= array(
	"extensions"	=> array("cbz", "zip"),
	"binary"	=> "unzip",
	"cmd-skeleton"	=> "{COMMAND} \"{COMIC}\" '-d' \"{DIRECTORY}\""
);
$wcCompressors["TAR"]	= array(
	"extensions"	=> array("cbt", "tar"),
	"binary"	=> "tar",
	"cmd-skeleton"	=> "{COMMAND} '-xf' \"{COMIC}\" '-C' \"{DIRECTORY}\""
);
/* @} */

$wcDefaults["debug"]			= false;
$wcDefaults["avatar-basic"]		= "{$wcROOTURI}/images/avatars";
$wcDefaults["avatar-theme"]		= $wcDefaults["avatar-basic"];
$wcDefaults["avatar-cache"]		= "{$wcPaths["cache-directory-uri"]}/avatars";
$wcDefaults["preview"]			= "{$wcROOTURI}/images/wcomix-no-preview.png";
$wcDefaults["loading"]			= "{$wcROOTURI}/images/wcomix-loading.gif";
$wcDefaults["icon-add"]			= "{$wcROOTURI}/images/icons/add.png";
$wcDefaults["icon-delete"]		= "{$wcROOTURI}/images/icons/delete.png";
$wcDefaults["icon-home"]		= "{$wcROOTURI}/images/icons/wcomix-home.png";
$wcDefaults["icon-tag"]			= "{$wcROOTURI}/images/icons/wcomix-folder-star.png";
$wcDefaults["icon-collection"]		= "{$wcROOTURI}/images/icons/wcomix-folder-star.png";
$wcDefaults["icon-directory"]		= "{$wcROOTURI}/images/icons/wcomix-folder.png";
$wcDefaults["icon-mobile"]		= "{$wcROOTURI}/images/icons/wcomix-mobile.png";
$wcDefaults["icon-edit"]		= "{$wcROOTURI}/images/icons/pencil.png";
$wcDefaults["icon-light-on"]		= "{$wcROOTURI}/images/icons/light-on.png";
$wcDefaults["icon-light-off"]		= "{$wcROOTURI}/images/icons/light-off.png";
$wcDefaults["icon-info"]		= "{$wcROOTURI}/images/icons/wcomix-notice.png";
$wcDefaults["allow-hiddens"]		= false;
$wcDefaults["thumbs-size"]		= 128;		// in pixels.
$wcDefaults["page-cache"]		= true;
$wcDefaults["action"]			= false;
$wcDefaults["mobile-action"]		= false;
$wcDefaults["group"]			= false;
$wcDefaults["public-group"]		= true;
$wcDefaults["installed"]		= false;
$wcDefaults["session-max-time"]		= 86400;	// in seconds.
$wcDefaults["stats-max-time"]		= 7;		// in days. 0 disables.
$wcDefaults["directory-permissions"]	= 0777;
$wcDefaults["max-autoexpand"]		= 50;
$wcDefaults["theme"]			= "default";
$wcDefaults["theme-mobile"]		= "mdefault";
$wcDefaults["no-credits"]		= false;
$wcDefaults["no-logs"]			= true;
$wcDefaults["read-only"]		= false;

/*
* Loading database structure specs
* @{
*/
$wcDatabase["tables"][]		= "/config/db/wc_cache.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_collections.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_comics.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_directories.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_groups.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_group_users.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_read_rates.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_rule_actions.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_rules.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_search_index.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_search_items.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_session_keeps.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_sessions.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_stats_timer.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_tag_members.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_tags.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_user_data.tab.xml";
$wcDatabase["tables"][]		= "/config/db/wc_users.tab.xml";

$wcDatabase["indexes"][]	= "/config/db/wc_cache.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_group_users.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_read_rates.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_search_items.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_sessions.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_stats_timer.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_tag_members.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_user_data.pk.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_comics-cmc_name.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_directories-dir_name.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_search_index-six_word.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_search_items-sit_word.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_stats_timer-st_t_sdate.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_tag_members-mem_item.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_tags-tag_group.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_tags-tag_name.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_user_data-usd_email.idx.xml";
$wcDatabase["indexes"][]	= "/config/db/wc_users-usr_username.idx.xml";
/* @} */

$wcCronProfiles[$wcCronProfile] = array(
	"garbage.move",
	"comic.updatenames",
	"directory.updatenames",
	"lists.update",
	"rules.run",
	"autotag.updateNOTAG",
	"autotag.updateFEWTAGS",
	"lists.losts",
	"previews.update",
	"search.updateindex",
	"statistics.update"
);
$wcCronProfiles["tagger"] = array(
	"rules.run",
	"autotag.updateNOTAG",
	"autotag.updateFEWTAGS",
	"previews.update",
	"search.updateindex"
);
$wcCronProfiles["names"] = array(
	"comic.updatenames",
	"directory.updatenames",
	"previews.update",
	"search.updateindex"
);

$wcSpecialTags[]	= WC_SPECIAL_TAG_TRASH;
$wcSpecialTags[]	= WC_SPECIAL_TAG_DUPLICATED;
$wcSpecialTags[]	= WC_SPECIAL_TAG_REORDER;
$wcSpecialTags[]	= WC_SPECIAL_TAG_WRONG_TAGS;
$wcSpecialTags[]	= WC_SPECIAL_TAG_UNTAGGED;
$wcSpecialTags[]	= WC_SPECIAL_TAG_FEW_TAGS;
/** @} */

require_once "{$wcROOTDIR}/config/permissions.php";

//
// Action handlers for services.
// @{
$wcServicesHandlers[WC_SERVICE_COMICS]		= "{$wcPaths["services-directory"]}/s.comics.php";
$wcServicesHandlers[WC_SERVICE_TAGS]		= "{$wcPaths["services-directory"]}/s.tags.php";
$wcServicesHandlers[WC_SERVICE_DIRECTORIES]	= "{$wcPaths["services-directory"]}/s.directories.php";
$wcServicesHandlers[WC_SERVICE_COLLECTIONS]	= "{$wcPaths["services-directory"]}/s.collections.php";
$wcServicesHandlers[WC_SERVICE_RULES]		= "{$wcPaths["services-directory"]}/s.rules.php";
$wcServicesHandlers[WC_SERVICE_LOG_IN]		= "{$wcPaths["services-directory"]}/s.login.php";
$wcServicesHandlers[WC_SERVICE_LOG_OUT]		= "{$wcPaths["services-directory"]}/s.logout.php";
$wcServicesHandlers[WC_SERVICE_SETREADRATE]	= "{$wcPaths["services-directory"]}/s.readrate.php";
$wcServicesHandlers[WC_SERVICE_MOBILE]		= "{$wcPaths["services-directory"]}/s.mobile.php";
$wcServicesHandlers[WC_SERVICE_USERS]		= "{$wcPaths["services-directory"]}/s.users.php";
// @}

//
// Action handlers for rss.
// @{
$wcRSSHandlers[WC_RSS_TAG]		= "{$wcPaths["rss-directory"]}/r.tag.php";
// @}

// @formatter:on
require_once "{$wcPaths["includes-directory"]}/db/WCConnection.php";
require_once "{$wcPaths["includes-directory"]}/db/WCMassiveInstaller.php";
require_once "{$wcPaths["includes-directory"]}/representations/WCRepresentation.abs.php";
require_once "{$wcPaths["includes-directory"]}/representations/WCTableRepresentation.abs.php";
require_once "{$wcPaths["includes-directory"]}/representations/WCGTableRepresentation.abs.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCHolder.abs.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCBasicHolder.abs.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCGHolder.abs.php";
require_once "{$wcPaths["includes-directory"]}/containers/WCContainer.abs.php";
require_once "{$wcPaths["includes-directory"]}/containers/WCBasicContainer.php";
require_once "{$wcPaths["includes-directory"]}/containers/WCGContainer.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCComicsHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCDirectoriesHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCUsersHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCUserDataHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCGroupsHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCTagsHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCCollectionsHolder.php";
require_once "{$wcPaths["includes-directory"]}/holders/WCRulesHolder.php";
require_once "{$wcPaths["includes-directory"]}/parser/WCParser.php";
require_once "{$wcPaths["includes-directory"]}/security/WCSessions.php";
require_once "{$wcPaths["includes-directory"]}/security/WCProfile.php";
require_once "{$wcPaths["includes-directory"]}/search/WCSearch.php";
require_once "{$wcPaths["includes-directory"]}/tools.php";
require_once "{$wcPaths["includes-directory"]}/WCTimer.php";
require_once "{$wcPaths["includes-directory"]}/WCPageCache.php";
require_once "{$wcPaths["includes-directory"]}/WCReadRate.php";
require_once "{$wcPaths["includes-directory"]}/WCOptions.php";
require_once "{$wcPaths["includes-directory"]}/WCLog.php";
require_once "{$wcPaths["includes-directory"]}/WCTheme.php";
//
// Loading tools.
// Warning: they only load when it is a shell execution.
// @{
if(defined("__SHELL__")) {
	require_once "{$wcPaths["includes-directory"]}/WCToolsManager.php";
	require_once "{$wcPaths["tools-directory"]}/t.comic.clean.php";
	require_once "{$wcPaths["tools-directory"]}/t.directory.lostthumbs.php";
	require_once "{$wcPaths["tools-directory"]}/t.group.create.php";
}
// @}

//
// Loading cron.
// Warning: they only load when it is a shell execution.
// @{
if(defined("__SHELL__")) {
	require_once "{$wcPaths["includes-directory"]}/WCCron.php";
}
// @}

// Personal configuration.
// @{
if(is_readable(WCSanitizer::SystemPath($wcPaths["config-local"]))) {
	require_once $wcPaths["config-local"];
} else {
	//
	// When there's no personal configuration the flag WC_NOT_INSTALLED is
	// set to indicate the system is not installed.
	define('WC_NOT_INSTALLED', true);

	@include $wcPaths["install-tmps"]["group"];
	@include $wcPaths["install-tmps"]["db"];
	@include $wcPaths["install-tmps"]["defaults"];

	if(is_readable($wcPaths["install-tmps"]["db"])) {
		WCMassiveInstaller::Instance()->install();
	}
}
// @}

if(!defined("WC_NOT_INSTALLED")) {
	require_once "{$wcROOTDIR}/config/post.config.php";
	require_once "{$wcROOTDIR}/themes/{$wcDefaults["theme"]}/Class.php";
	require_once "{$wcROOTDIR}/themes/{$wcDefaults["theme-mobile"]}/Class.php";
	//
	// Loading basic rule actions handlers.
	// @{
	require_once "{$wcPaths["extensions-directory"]}/TagsRelator/Class.php";
	// @}

	WCMassiveInstaller::Instance()->install();
}
?>
